/*
2021-8-8
https://leetcode-cn.com/problems/check-if-string-is-a-prefix-of-array/
*/
class Solution {
public:
    bool isPrefixString(string s, vector<string>& words) {
        int len1=s.size();
        int id=0;
        for(auto t:words)
        {
            int len2=t.size();
            if(id+len2>len1) return false;
            for(int i=0;i<len2;i++)
                if(s[i+id]!=t[i]) return false;
            id+=len2;
            if(id==len1) return true;
        }
        if(id!=len1) return false;
        return true;
    }
};

